<template>
  <div>  
    <h1>{{ message }}</h1>  
    <button @click="greet">greet</button>  
  </div>  
</template>

<script>
export default {
 data() {  
    return {  
      message: 'Hello, Vue3!'  
    }  
  },  
  methods: {  
    greet() {  
    //$attrs接收父组件传给当前组件的name属性
      this.message = 'Hello, ' + this.$attrs.name + '!'  
    }  
  }  
}
</script>
<style>

</style>